<?php
	require_once($_SERVER["DOCUMENT_ROOT"]."/global.php");
	require_once($_SERVER["DOCUMENT_ROOT"]."/modules/security_mod.php");
	require_once($_SERVER["DOCUMENT_ROOT"]."/modules/channel_mod.php");

	SecurityMod::login();

	$level = $_SESSION["account"]->getLevel();
        $chatLevel = $_SESSION["account"]->getChatLevel();
	if ($level != "Admin" && $chatLevel != 3)
		SecurityMod::logout();

        $id = v($_REQUEST, "id");
        $name = v($_REQUEST, "name");

        if(isset($name))
            ChannelMod::updateChannel($id, $name);
	
	header('location: chat_channels.php');
?>
